package cn.village.service.impl;

import cn.village.dao.VaAssetsManagementDao;
import cn.village.entity.VaAssetsManagement;
import cn.village.service.VaAssetsManagementService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (VaAssetsManagement)表服务实现类
 *
 * @author makejava
 * @since 2021-03-08 18:59:07
 */
@Service("vaAssetsManagementService")
public class VaAssetsManagementServiceImpl implements VaAssetsManagementService {
    @Resource
    private VaAssetsManagementDao vaAssetsManagementDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public VaAssetsManagement queryById(Integer id) {
        return this.vaAssetsManagementDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<VaAssetsManagement> queryAllByLimit(int offset, int limit) {
        return this.vaAssetsManagementDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param vaAssetsManagement 实例对象
     * @return 实例对象
     */
    @Override
    public VaAssetsManagement insert(VaAssetsManagement vaAssetsManagement) {
        this.vaAssetsManagementDao.insert(vaAssetsManagement);
        return vaAssetsManagement;
    }

    /**
     * 修改数据
     *
     * @param vaAssetsManagement 实例对象
     * @return 实例对象
     */
    @Override
    public VaAssetsManagement update(VaAssetsManagement vaAssetsManagement) {
        this.vaAssetsManagementDao.update(vaAssetsManagement);
        return this.queryById(vaAssetsManagement.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.vaAssetsManagementDao.deleteById(id) > 0;
    }

    /**
     * 查询指定数据
     * @param offset
     * @param limit
     * @return
     */
    @Override
    public List<VaAssetsManagement> queryByList(int offset, int limit) {

        return vaAssetsManagementDao.queryByList(offset,limit);
    }

    @Override
    public Integer count() {
        return vaAssetsManagementDao.count();
    }


}